package com.leenmvc.core.security.entity.core;

import com.leenmvc.core.annotation.DbInfo;
import com.leenmvc.core.annotation.PrimaryKey;
import com.leenmvc.core.annotation.TableField;
import com.leenmvc.core.annotation.validator.Exist;
import com.leenmvc.core.annotation.validator.groups.DeleteGroup;
import com.leenmvc.core.security.dao.core.SysRoleMenuDao;
import com.leenmvc.core.utils.collection.TreeNode;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 菜单管理
 *
 * @author leen
 */
@DbInfo(value = "sys_menu", comment = "菜单")
public class SysMenu extends TreeNode<SysMenu> implements Serializable {

	@PrimaryKey
	@Exist(classes = {SysRoleMenuDao.class},
			fields = {"menuId"},
			groups = {DeleteGroup.class})
	private Long id;

	/**
	 * 父菜单ID，一级菜单为0
	 */
	private Long pid;
	/**
	 * 菜单名称
	 */
	@TableField(false)
	private String name;
	/**
	 * 菜单URL
	 */
	private String url;
	/**
	 * 类型   0：菜单   1：按钮
	 */
	private Integer type;


	/**
	 * 菜单图标
	 */
	private String icon;
	/**
	 * 排序
	 */
	private Integer sort;

	/**
	 * 更新者
	 */
	private Long updater;
	/**
	 * 更新时间
	 */
	private Date updateDate;

	/**
	 * 是否显示 , 1：显示， 0：不显示
	 */
	private Integer isShow;

	/**
	 * 是否自生成菜单 0：否，1：是
	 */
	private Integer template;

	/**
	 * 前端判断字段：0未选中1已选中
	 */
	@TableField(false)
	private Integer sign;

	/**
	 * 顶级Id
	 */
	@TableField(false)
	private Long topId;

	/**
	 * 上级菜单名称
	 */
	@TableField(false)
	private String parentName;

	@TableField(false)
	private List<SysMenuPermisson> menuPermissionList;

	protected Long creator;

	protected Date createDate;

	public Integer getIsShow() {
		return isShow;
	}

	public void setIsShow(Integer isShow) {
		this.isShow = isShow;
	}

	public Long getCreator() {
		return creator;
	}

	public void setCreator(Long creator) {
		this.creator = creator;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Long getPid() {
		return pid;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public Long getUpdater() {
		return updater;
	}

	public void setUpdater(Long updater) {
		this.updater = updater;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public void setId(Long id) {
		this.id = id;
	}

	public Integer getTemplate() {
		return template;
	}

	public void setTemplate(Integer template) {
		this.template = template;
	}

	public Long getTopId() {
		return topId;
	}

	public void setTopId(Long topId) {
		this.topId = topId;
	}

	public Integer getSign() {
		return sign;
	}

	public void setSign(Integer sign) {
		this.sign = sign;
	}

	public List<SysMenuPermisson> getMenuPermissionList() {
		return menuPermissionList;
	}

	public void setMenuPermissionList(List<SysMenuPermisson> menuPermissionList) {
		this.menuPermissionList = menuPermissionList;
	}
}
